<?php
(!defined('IN_TOA') || !defined('IN_ADMIN')) && exit('Access Denied!');
/*
	[天生创想] (C)2008-2011 515158 Inc.
	This is NOT a freeware, use is subject to license terms
    URL:http://www.515158.com/
*/

get_config_keytable("date_workdate_Increase");
empty($do) && $do = 'list';
if ($do == 'list') {
	include_once('template/add.php');

} elseif ($do == 'save') {
	
	$savetype = getGP('savetype','P');
	$otype = getGP('otype','P');
	$title = getGP('title','P');
	$startdate = getGP('startdate','P')." ".getGP('starth','P').":".getGP('starti','P').":00";
	$enddate = getGP('enddate','P')." ".getGP('endh','P').":".getGP('endi','P').":00";
	$content = getGP('content','P');
	$date = get_date('Y-m-d H:i:s',PHP_TIME);
	$type = getGP('type','P');
	$uid=$_USER->id;
	
	
	//主表信息
	$workdate = array(
		'title' => $title,
		'otype' => $otype,
		'startdate' => $startdate,
		'enddate' => $enddate,
		'content' => $content,
		'date' => $date,
		'type' => $type,
		'uid' => $uid
	);
	//写入主表信息
	insert_db('workdate',$workdate);
    $id=$db->insert_id();
	$content=$title.get_inc_log(1).$otype.get_inc_log(1).$startdate.get_inc_log(1).$enddate.get_inc_log(1).$content.get_inc_log(1).$type;
	$title='新建日程信息';
	get_oa_log_dbadd($id,$content,$title,10,$_USER->id);
	//echo '<script language="JavaScript">window.close();window.opener.location.reload();/script>';
	goto_page('admin.php?ac=index&fileurl=workdate&type=1');

}
?>